<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="jakarta.tags.core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<%=request.getContextPath()%>/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员管理 - 医疗预约系统后台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="statics/css/hisStyle.css">
    <link rel="stylesheet" href="statics/css/common-styles.css">
</head>
<body>
<!-- 侧边栏 -->
<%@include file="../common/sidebar.jsp"%>
<!-- 主内容区域 -->
<div class="main-content">
    <!-- 顶部导航 -->
    <%@include file="../common/top.jsp"%>
    <!-- 内容区域 -->
    <div class="function-page">
        <div class="page-header">
            <h1>管理员管理</h1>
        </div>
        
        <div class="action-bar">
            <a href="admin/toAdd" class="btn btn-primary">
                <i class="fas fa-plus-circle"></i> 新增管理员
            </a>
        </div>
        
        <div class="data-section">
            <table class="data-table">
            <thead>
            <tr>
                <th>编号</th>
                <th>用户名</th>
                <th>电话</th>
                <th>头像</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <!-- 使用JSTL标签遍历管理员列表 -->
            <c:forEach items="${adminList}" var="admin" varStatus="status">
                <tr>
                    <td>${status.index + 1}</td>
                    <td>${admin.username}</td>
                    <td>${admin.email}</td>
                    <td>
                        <c:choose>
                            <c:when test="${admin.headpic != null && admin.headpic != ''}">
                                <img src="statics/images/adminHead/${admin.headpic}" class="list-avatar" alt="头像">
                            </c:when>
                            <c:otherwise>
                                <img src="statics/images/adminHead/admin.png" class="list-avatar" alt="默认头像">
                            </c:otherwise>
                        </c:choose>
                    </td>
                    <td class="operations">
                        <a href="admin/toEdit?userid=${admin.userid}" class="btn btn-primary btn-sm">
                            <i class="fas fa-edit"></i> 编辑
                        </a>
                        <a href="admin/delete?userid=${admin.userid}" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除该管理员吗？');">
                            <i class="fas fa-trash-alt"></i> 删除
                        </a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
            </table>
        </div>
    </div>
</div>
</body>
</html>